//
//  SHTwoViewController.m
//  代理传值~dome
//
//  Created by 石虎 on 2017/8/9.
//  Copyright © 2017年 shihu. All rights reserved.
//

#import "SHTwoViewController.h"
#import "ViewController.h"

@interface SHTwoViewController ()

//分享输入文字
@property (weak, nonatomic) IBOutlet UITextField *shareInputField;
//开始传值按钮
- (IBAction)shareInputClick:(UIButton *)sender;

@end

@implementation SHTwoViewController

#pragma mark - 返回上级界面
- (IBAction)shareInputClick:(UIButton *)sender {
    //返回上级界面
   [self dismissViewControllerAnimated:YES completion:nil];
}

#pragma mark - 点击触摸退出键盘
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self.view endEditing:YES];
}

#pragma mark - 实现代理传值
-(void)viewWillDisappear:(BOOL)animated {
    
    if (self.delegate && [self.delegate respondsToSelector:@selector(changeValue:)]) {
        //实现代理传值
        [self.delegate changeValue:self.shareInputField.text];
    }
}
- (void)viewDidLoad {
    [super viewDidLoad];
}

@end
